package com.wy.kdemo.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter

class ViewPageAdapter(fragmentManager: FragmentManager) :
    FragmentStatePagerAdapter(fragmentManager) {

    private var fragments: MutableList<Fragment> = mutableListOf()

    constructor(
        fragmentManager: FragmentManager,
        fragments: List<Fragment>
    ) : this(fragmentManager) {
        this.fragments.addAll(fragments)
    }

    override fun getCount(): Int {
        return fragments.size
    }

    override fun getItem(position: Int): Fragment {
        return fragments[position]
    }


}